<template>
  <svg :class="className" aria-hidden="true" :style="css">
    <use :xlink:href="href"></use>
  </svg>
</template>

<script>
import { ref, computed } from "@vue/composition-api";
export default {
  name: "svg-icon",
  // props:["iconClass","className"],
  props: {
    icon: {
      type: String,
      default: ""
    },
    extraClass: {
      type: String,
      default: ""
    },
    css: {
      type: Object,
      default: () => ({})
    }
  },
  setup(props, ctx) {
    return {
      href: computed(() => {
        return `#icon-${props.icon}`;
      }),
      className: computed(() => {
        return props.extraClass ? `svg-icon ${props.extraClass}` : `svg-icon`;
      })
    };
  }
};
</script>

<style lang="scss" scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: middle;
}
</style>
